Skip to content

[6.40] [RF] Fix RooBinIntegrator for ranges cutting through integrand bins - #22930

Open
root-project-bot wants to merge 1 commit into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_22922
Open

[6.40] [RF] Fix RooBinIntegrator for ranges cutting through integrand bins#22930
root-project-bot wants to merge 1 commit into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_22922

Conversation

@root-project-bot

Copy link
Copy Markdown

Backport of #22922, requested by @guitargeek.

RooBinIntegrator builds its integration grid from the integrand's
binBoundaries(xlo, xhi), which only returns the boundaries lying strictly
inside the integration range. As a result, the integrator summed only the
bins fully contained in the range and silently dropped the partial bins at
the edges, because the integration limits were never added as the outermost
bin boundaries.

For example, integrating a 5-bin RooHistPdf (edges 0,2,4,6,8,10) over the
sub-range [3,7] returned 2 instead of the correct 5.5.

Fix this by prepending xmin and appending xmax as the outermost boundaries
when they are not already present. The guard avoids zero-width bins when a
range boundary coincides with a bin edge. Each resulting sub-bin then lies
entirely within one original bin, so the midpoint rule stays exact for a
piecewise-constant histogram.

Add unit tests comparing the numeric RooBinIntegrator result against the
analytic RooHistPdf integral for several range types, in both one and two
dimensions.

Closes root-project#22858.

🤖 Done with the help of AI.

(cherry picked from commit ba4e908)
@github-actions

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 7h 26m 11s ⏱️
 3 860 tests  3 513 ✅   0 💤 347 ❌
76 242 runs  75 493 ✅ 402 💤 347 ❌

For more details on these failures, see this check.

Results for commit 730c12b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants